<%@ page language="java" import="java.util.*, com.zjut.zs.util.tools.*,com.zjut.zs.userinfo.manager.*, com.zjut.zs.userinfo.dao.*,
com.zjut.zs.user.manager.*, com.zjut.zs.user.dao.*,com.zjut.an.util.tools.*,com.zjut.an.util.system.*,
com.zjut.zs.userstatus.manager.*, com.zjut.zs.userstatus.dao.*" pageEncoding="utf-8"%>
<!DOCTYPE html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <title>用户信息 - 招生报名系统</title>
    <script src="css/tailwindcss.css"></script>

<style type="text/css">
.input-focus {
    transition: all 0.3s ease;
}
.input-focus:focus {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}
.card {
    transition: all 0.3s ease;
}
.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}
</style>
</head>
<body class="bg-gray-50 min-h-screen flex items-center justify-center py-8">
	<jsp:include page="zs_uservalidate.jsp" flush="true"></jsp:include>
<%
if (session.getAttribute("zsUser") == null&&session.getAttribute("admin") == null&&session.getAttribute("user") == null) {
	out.print("<script>alert('由于长时间未操作，系统已经自动注销，请重新登陆');</script>");
	out.print("<script>top.window.location='main.jsp';</script>");
} else {

ZsUserManager umanager = (ZsUserManager) SpringContextUtil.getBean("ZsUserManager");
ZsUserStatusManager smanager = (ZsUserStatusManager) SpringContextUtil.getBean("ZsUserStatusManager");
ZsUser user = new ZsUser();
if(session.getAttribute("admin")!=null && request.getParameter("usId")!=null) {
	String usId = request.getParameter("usId");
	user = umanager.getData(usId);
} else if (session.getAttribute("zsUser")!=null) {
	user = (ZsUser)session.getAttribute("zsUser");
}
ZsUserStatus userStatus = smanager.getDataByUser(user);
%>

    <div class="w-full max-w-md mx-auto px-4">
        <div class="bg-white rounded-xl shadow-lg border border-gray-100 p-8">
            <div class="text-center mb-8">
                <h1 class="text-2xl font-bold text-gray-800 mb-2">用户信息管理</h1>
                <p class="text-gray-600">修改您的个人注册信息</p>
            </div>

            <form id="ff" name="add" role="form" class="form-horizontal" action="" method="post">
                <div class="space-y-6">
                    <!-- 身份证号 -->
                    <div>
                        <label for="usIdcard" class="block text-sm font-medium text-gray-700 mb-2">
                            身份证号 <span class="text-red-500">*</span>
                        </label>
                        <input id="usIdcard" name="usIdcard" type="text"
                               class="w-full px-4 py-3 border border-gray-300 rounded-lg bg-gray-100 cursor-not-allowed form-input"
                               placeholder="身份证号"
                               value="<%=user.getUsIdcard() %>"
                               readonly/>
                        <p class="text-sm text-gray-500 mt-1">*请仔细填写，用于账号登录</p>
                    </div>

                    <!-- 高考序号 -->
                    <div>
                        <label for="usBmxh" class="block text-sm font-medium text-gray-700 mb-2">
                            高考序号 <span class="text-red-500">*</span>
                        </label>
                        <input id="usBmxh" name="usBmxh" type="text"
                               class="w-full px-4 py-3 border border-gray-300 rounded-lg bg-gray-100 cursor-not-allowed form-input"
                               placeholder="高考序号"
                               value="<%=user.getUsBmxh() %>"
                               readonly/>
                    </div>

                    <!-- 密码 -->
                    <div>
                        <label for="usPassword" class="block text-sm font-medium text-gray-700 mb-2">
                            密码<span class="text-sm text-red-500 mt-1">*</span>
                        </label>
                        <div class="relative">
                            <input id="usPassword" name="usPassword" type="password"
                                   class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent transition-colors duration-200 form-input"
                                   placeholder="新密码"
                                   data-rule-psw="true"
                                   minlength="8"
                                   data-msg-minlength="请输入最小8位"
                                   value=""/>
                            <img src="images/eye.png" class="absolute right-3 top-1/2 transform -translate-y-1/2 w-5 h-5 cursor-pointer" id="img" onclick="togglePasswordVisibility()">

                        </div>
                        <p class="text-sm text-red-500 mt-1">*8-20位的大写字母，小写字母，数字和特殊字符4种组合，如不修改请置空</p>
                    </div>

                    <!-- 确认密码 -->
                    <div>
                        <label for="rusPassword" class="block text-sm font-medium text-gray-700 mb-2">
                            确认密码<span class="text-sm text-red-500 mt-1">*</span>
                        </label>
                        <input id="rusPassword" name="rusPassword" type="password"
                               class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent transition-colors duration-200 form-input"
                               placeholder="确认新密码"
                               equalTo="#usPassword"
                               value=""/>

                    </div>

                    <!-- 真实姓名 -->
                    <div>
                        <label for="usName" class="block text-sm font-medium text-gray-700 mb-2">
                            真实姓名 <span class="text-red-500">*</span>
                        </label>
                        <input id="usName" name="usName" type="text"
                               class="w-full px-4 py-3 border border-gray-300 rounded-lg bg-gray-100 cursor-not-allowed form-input"
                               required
                               placeholder="姓名"
                               value="<%=user.getUsName() %>"
                               readonly/>
                        <p class="text-sm text-gray-500 mt-1">*请填写真实姓名</p>
                    </div>

                    <!-- 手机号码 -->
                    <div>
                        <label for="usMobile" class="block text-sm font-medium text-gray-700 mb-2">
                            手机号码 <span class="text-red-500">*</span>
                        </label>
                        <input id="usMobile" name="usMobile" type="text"
                               class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent transition-colors duration-200 form-input"
                               placeholder="手机号"
                               required
                               data-rule-mobile="true"
                               data-msg-required="请输入手机号"
                               data-msg-mobile="请输入正确格式"
                               value="<%=user.getUsMobile() %>"/>
                    </div>

                    <!-- 隐藏字段 -->
                    <input id="addTime" name="addTime" type="text" class="dfinput" value="<%=user.getAddTime()%>" style="display:none;"/>
                    <input id="editTime" name="editTime" type="text" class="dfinput" value="<%=user.getEditTime()%>" style="display:none;"/>
                    <input id="loginTime" name="loginTime" type="text" class="dfinput" value="<%=user.getLoginTime()%>" style="display:none;"/>
                    <input id="usId" name="usId" type="text" class="dfinput" value="<%=user.getUsId() %>" style="display:none;"/>
                    <input id="usNo" name="usNo" type="text" class="dfinput" value="<%=user.getUsNo() %>" style="display:none;"/>
                    <input id="usActive" name="usActive" type="text" class="dfinput" value="<%=user.getUsActive() %>" style="display:none;"/>

                    <!-- 提交按钮 -->
                    <div class="pt-4">
                        <button type="submit"
                                class="w-full bg-blue-600 hover:bg-blue-700 text-white font-medium py-3 px-4 rounded-lg transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2">
                            确认保存
                        </button>
                    </div>
                </div>
            </form>
        </div>
    </div>
<script src="../plugins/assets/plugins/jquery-3.5.1.min.js" type="text/javascript"></script>
<script src="../plugins/assets/plugins/jquery-validation-1.14.0/dist/jquery.validate.js" type="text/javascript"></script>
<script src="../plugins/assets/plugins/jquery-validation-1.14.0/dist/jquery.metadata.js" type="text/javascript"></script>
<script src="js/formvalidate.js" type="text/javascript"></script>
<script src="../admin/js/publicManager.js" type="text/javascript" charset="utf-8"></script>


		<script type="text/javascript">
		var updateOneAction = '../zsUserUpdate.action?randnum='+Math.floor(Math.random()*1000000);
		var loactionurl = 'zs_user.jsp';

		$(function(){
		    //jquery.validate
			$("#ff").validate({
				submitHandler: function() {
					//验证通过后 的js代码写在这里
					submitForm();
				}
			})
		})
        function togglePasswordVisibility() {
            var passwordInput = document.getElementById('usPassword');
            var img = document.getElementById('img');
            if (passwordInput.type === 'password') {
                passwordInput.type = 'text';
                img.src = 'images/eye-close.png'; // 切换为闭眼图标
            } else {
                passwordInput.type = 'password';
                img.src = 'images/eye.png'; // 切换为睁眼图标
            }
        }
        </script>
<%} %>
</body>

</html>
